home *** CD-ROM | disk | FTP | other *** search
- Path: anvil.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c,alt.msdos.programmer
- Subject: Re: MSVC based TSRs
- Followup-To: alt.msdos.programmer
- Date: 12 Feb 1996 10:56:30 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4fo2guINNrcv@anvil.ugrad.cs.ubc.ca>
- References: <4fm8ll$f6a@news.voicenet.com>
- NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
-
- In article <4fm8ll$f6a@news.voicenet.com>, Michael <babump@voicenet.com> wrote:
- >I understand the basics of a TSR, and now I'm trying one in MSVC++. I
- >can't use a COM file, becuase __interrupts must be __far. Which makes
- >it harder to do. How you you make a EXE using multiple segments a
- >TSR? How many paragraphs do you keep(_dos_keep)? Won't that just
- >keep the first segment? Then all the other segments are unasigned and
- >can be over written. So, how is this accommplished?
-
- Funny people are still doing this stuff in 1995! :)
-
- The memory model you choose for your program has nothing to do with the
- interrupt invocation method used by the hardware, which in this case looks a
- lot like a an intersegment call.
-
- The C language doesn't provide a way to write interrupt service routines
- directly. Operating systems often have assembly language interrupt handlers
- which call C routines using C calling conventions. In essence, these routines
- provide the necessary "glue".
-
- You must write an assembly interrupt handler. The C language has no provisions
- for accessing machine registers (unless you use non-portable extensions), and
- the interrupt service routine must save these registers plus the flags.
-
- The assembly-lanuage service routine can infer what code segment the rest of
- your C program occupies, and can hence call your C routines as near functions.
- Have you looked at the code for a TSR? One of the things TSRs typically do is
- set the data segment, which is another thing that you need to do if your C code
- is to ever correctly reference its variables, and it's another thing that
- cannot be done in the C language.
-
- Although this is a DOS-specific question, it does raise certain language
- issues, such as the distinction between interrupt invocations and function
- calls. They are not the same thing, even though in the 8086 they are close
- cousins. Thus is is pointless to match the storage type of a procedure to match
- the conventions of an interrupt call.
-
- Nevertheless, can you guess $here I set the followups to?
- --
-
-